//
//  HMStatusBottomView.swift
//  VVeibo21
//
//  Created by apple on 2016/10/27.
//  Copyright © 2016年 Apple. All rights reserved.
//

import UIKit

class HMStatusBottomView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
   @objc private func buttonClick(){
        
    }
    
    private func setupUI(){
        
        let retWeetButton = addChildButtons(imageName: "timeline_icon_retweet", title: "转发")
        let commentButton = addChildButtons(imageName: "timeline_icon_comment", title: "评论")
        let likeButton = addChildButtons(imageName: "timeline_icon_unlike", title: "赞")
        
        retWeetButton.snp_makeConstraints { (make) in
            make.top.bottom.left.equalTo(self)
            make.width.equalTo(commentButton)
        }
        commentButton.snp_makeConstraints { (make) in
            make.top.bottom.equalTo(self)
            make.left.equalTo(retWeetButton.snp_right)
            make.width.equalTo(likeButton)
        }
        likeButton.snp_makeConstraints { (make) in
            make.top.bottom.right.equalTo(self)
            make.left.equalTo(commentButton.snp_right)
        }
        
    }
    
    func addChildButtons(imageName:String, title:String)->UIButton{
        
        let button = UIButton(setHighlightedImgName: imageName, title: title, target: self, action: #selector(buttonClick))
        button.setBackgroundImage(UIImage(named:"timeline_card_bottom_background"), for: UIControlState.normal)
        button.setBackgroundImage(UIImage(named:"timeline_card_bottom_background_highlighted"), for: UIControlState.highlighted)
        addSubview(button)
        
        button.backgroundColor = UIColor.green
        
        return button
        
    }

}
